package com.xyzwps.ewa.modules.auth.password

import com.password4j.Password

/**
 * [Password4j Bcrypt](https://github.com/Password4j/password4j/wiki/BCrypt).
 */
class BcryptPasswordEncryptor : PasswordEncryptor {

    override fun encrypt(password: String): String = Password
        .hash(password)
        .addPepper()
        .withBcrypt()
        .result

    override fun verify(password: String, encrypted: String): Boolean = Password
        .check(password, encrypted)
        .withBcrypt()
}